/**
 * 
 */
package sandBox;
import java.awt.Canvas;
import java.awt.Dimension;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JFrame;
import javax.swing.JPanel;

import model.Board;
import model.GrassTile;
import model.Tile;
import model.WaterTile;

import stage.BoardView;
/**
 * @author milk
 *
 */
public class OpenRampart {
	
	private Configuration configuration;
	private BoardView view;
	private JPanel panel;
	
	public OpenRampart(){
		this.configuration = Configuration.getConfiguration();
		
		JFrame window = new JFrame("openRampart");
		window.setBounds(0,0,configuration.getWidth(),configuration.getHeight());
		window.setVisible(true);
		window.addWindowListener( new WindowAdapter() {
	        public void windowClosing(WindowEvent e) {
	         System.exit(0);
	        }
	    });
		
		
		panel = (JPanel)window.getContentPane();
		panel.setPreferredSize(new Dimension(configuration.getWidth(),configuration.getHeight()));
		panel.setLayout(null);
		
		Board board = new Board(2, 2);
		board.setTile(0,0,new GrassTile());
		board.setTile(0,1,new GrassTile());
		board.setTile(1,0,new GrassTile());
		board.setTile(1,1,new WaterTile());
		
		
		view = new BoardView();
		view.setBounds(0,0,configuration.getWidth(),configuration.getHeight());
		view.setModel(board);
		
		panel.add(view);
		/*
		Canvas canvas = new CanvasMap();
		canvas.setBounds(0,0,configuration.getWidth(),configuration.getHeight());
		
		panel.add(canvas);
		*/
	}
	
	public void run(){
		//TODO: Menu de inicio (opciones y toda la bola varia)
		
	}
	
	/**
	 * @param args
	 */
	public static void main(String[] args) {
		OpenRampart or = new OpenRampart();
		or.run();
	}

}
